<template>
	<!-- 请假流程表单 -->
	<view class="container">
		<u-form :model="form" ref="uForm" label-width="200">
		  <u-form-item label="任务名称"
		    ><u-input v-model="form.name" disabled
		  /></u-form-item>
		  <u-form-item label="所属流程"
		    ><u-input v-model="form.belong" disabled
		  /></u-form-item>
		  <u-form-item label="请假人"
		    ><u-input v-model="formData.leaveApplicant" disabled
		  /></u-form-item>
		  <u-form-item label="委托人"
		    ><u-input v-model="form.client" disabled
		  /></u-form-item>
		  <u-form-item label="流程发起人"
		    ><u-input v-model="form.initiator" disabled
		  /></u-form-item>
		  <u-form-item label="优先级"
		    ><u-input v-model="form.priority" disabled class="input-color"
		  /></u-form-item>
		  <u-form-item label="状态"
		    ><u-input v-model="form.status" disabled
		  /></u-form-item>
		  <u-form-item label="请假原因">
			<u-input v-model="formData.reasonForLeave" disabled
		  /></u-form-item>
		  <u-form-item label="请假开始时间">
		    <u-input v-model="formData.leaveStartTime" disabled/>
		  </u-form-item>
		  <u-form-item label="请假截止时间">
		    <u-input v-model="formData.deadlineForLeave" disabled/>
		  </u-form-item>
		  <u-form-item label="创建时间">
		    <u-input v-model="form.time" disabled />
		  </u-form-item>
		</u-form>
	</view>
</template>

<script>
	import auditApi from "../../api/audit.js";
	export default {
		name:"business",
		props:['form'],
		data() {
			return {
				formData:{
					reasonForLeave:'',
					leaveApplicant:'',
					deadlineForLeave:'',
					leaveStartTime:'',
				}
			};
		},
		mounted() {
			setTimeout(()=>{
				console.log("table",this.form)
				auditApi
				  .getAuditDetail(
					{
					  "X-Access-Token": this.$store.state.token,
					},
					this.form.table
				  )
				  .then((res) => {
					  console.log(res);
					let {
					  reasonForLeave,
					  leaveApplicant,
					  deadlineForLeave,
					  leaveStartTime,
					} = res.data.result;
					this.formData.reasonForLeave = reasonForLeave;
					this.formData.leaveApplicant = leaveApplicant;
					this.formData.deadlineForLeave = deadlineForLeave;
					this.formData.leaveStartTime = leaveStartTime;
					
				  })
				  .catch((err) => {
					console.log(err);
				  });
			},0)
		}
	}
</script>

<style scoped lang="scss">
.container {
  width: 90%;
  margin: 0 auto;
}
</style>